import { defineStore } from 'pinia'
import util from '@/utils/index'

export const useThemeStore = defineStore({
    id: 'theme',
    state: () => {
      return {
        theme: ''
      }
    },
    getters: {
        getTheme: (state) => {
          console.log(state.theme);
          return state.theme
        }
    },
    actions: {
      initTheme() {
        this.theme = util.getStorage('them') || ""
      },
      switchTheme(theme: string) {
        this.theme = theme
    		util.setStorage('theme', theme)
      }
    }
  })